package org.javaboy.restful_demo.dao;

import org.javaboy.restful_demo.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.annotation.RestResource;

import java.util.List;

@RepositoryRestResource(path = "people",collectionResourceRel = "collection_user",itemResourceRel = "item_user")
public interface UserDao extends JpaRepository<User, Integer> {

    @RestResource(path = "byname",rel = "根据姓氏查询用户")
    List<User> findUsersByUsernameStartingWith(@Param("username") String username);
}
